$(function() {
	$.ajax({
		url: host + '/NPLAPI/GetProductCate',
		type: 'post',
		dataType: 'JSON',

		success: function(res) {
			var list = res.data
			if(res.state) {
				for(var i = 0; i < list.length; i++) {
					$('.case-tab-list').append(

						`
						<li class="tab-name">
						<a javascript: void (0) href="">${list[i].name}</a>
						</li>
						`
					)
//					$('.case-tab-list li:eq(0)').addClass('active')
					$(".case-tab-list li").click(function() {
						$(this).addClass("active").siblings().removeClass("active");
					})

				}

			}
		}
	});
	

	$.ajax({
		type: "post",
		url: host + '/CMSAPI/MainInList',
		dataType: 'JSON',
		data: {
			index: 1,
			size: 4,
			categorys: 168,
			menuID: 5,
			cid: cid
		},
		success: function(res) {
			var main = res.data.list
			if(res.state) {
				var html1 = '',html2=''
				for(var i = 0; i < main.length; i++) {
					html1 += `<li data-target="#myCarousel" data-slide-to="${i}" class="cicle"></li>`
					html2 +=`<div class="item">
								<div class='index-banner' style='background-image:url(${main[i].images[0].URL});'></div>
							</div>`
				}
				$('.carousel-indicators').append(html1);
				$('.carousel-inner').append(html2);
				$('.cicle:eq(0)').addClass('active');
				$('.item:eq(0)').addClass('active');
					
				$('.carousel').carousel({
					interval: 2500
				});
			}
		}
	});
	
})